<%-- 
    Document   : agregar
    Created on : Feb 23, 2012, 5:56:00 PM
    Author     : andreth
--%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<head>
    <script language="javascript" src="/CPYD/interfaz/javascript/validaciones.js"> 
    </script>
</head>
<logic:notPresent name="lista">
    <logic:present name="Lista" property="mensaje">
        <div>
        <b><font color="red">
         <bean:write name="Lista" property="mensaje"/>
         </font>
        </b>
        </div>
    </logic:present>
    <logic:present name="Lista" property="mensajeOK">
        <div>
        <b><font color="green">
        <bean:write name="Lista" property="mensajeOK"/>
        </font>
        </b>
        </div>
    </logic:present>
    
    <h2> Agregar Descripcion de Lista </h2>
    <html:form action="/agregarLista?method=save" onsubmit="return this">
        <table>  
            <tr>
                <td> Nombre de la lista </td>
                <td> <html:text property="nombre" onblur="validarAlfanumerico(this.value)"></html:text></td>
            </tr>
            <tr>
                <td> Numero de valores: 
                </td>
                <td>
                    <html:text property="numeroValores" onblur="validarNumerico(this.value)"></html:text>
                </td>
            </tr>
        </table>
        <br>
        <table>
            <tr>
                <td>Ejemplo:</td>

                <td> <strong>Nombre de la lista:</strong> Trimestre Fiscal</td>
            <tr>
                <td></td>
                <td> <strong>Numero de valores:</strong> 4 </td>
            </tr>
        </table>


        <div class="buttons">
            <button type="submit" class="positive">
                <img src="interfaz/images/agregar.png" alt=""/>
                <bean:message key="boton.agregar" />
            </button>
        </div>


    </html:form>
</logic:notPresent>

<br><br>
<hr>
<logic:present name="lista" property="idLista">
    <html:form action="/agregarValor" onsubmit="return this">
        <h2> Agregar Valores</h2>
        <table style="margin-left: 35%; margin-top: 2%;">
            <tr>
                <td><h3><bean:write name="lista" property="nombre"></bean:write></h3></td>
            </tr>
            
                
                <logic:iterate  name="lista" property="valores" id="valor" >
                    <% System.out.println("EN LA ITERACION! "); %>
                <tr >
                    <td> <html:text name="valor" property="valor" indexed="true" ></html:text>
                    </td>
                </tr>
                </logic:iterate>
                   
           
        </table>
        <html:hidden name="lista" property="idLista"/>
        <html:hidden name="lista" property="numeroValores"/>
        <div class="buttons">
            <button type="submit" class="positive">
                <img src="interfaz/images/agregar.png" alt=""/>
                <bean:message key="boton.agregar" />
            </button>
        </div>
    </html:form>
</logic:present>
